package com.admin_springboot.adminspringboot.common;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
 * 接口统一返回包装类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private Integer status;
    private String message;
    private Object data;

    //包装方法
    public static Result success(){
        return new Result(Constance.CODE_200,"成功",null);
    }

    public static Result success(String message,Object data ){
        return new Result(Constance.CODE_200,message,data);
    }

    public static Result error(String message){
        return new Result(Constance.CODE_failed,message,null);
    }

    public static Result error(){
        return new Result(Constance.CODE_500,"系统错误",null);
    }

}
